package com.example.homework1.Controller;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@SpringBootApplication
public class HomeworkApplication {
    public static void main(String[] args) {
        SpringApplication.run(com.example.homework1.Homework1Application.class, args);
    }
}

@RestController
class RandomNumberController {
    private final Random random = new Random();

    @GetMapping("/random")
    public int getRandomNumber() {
        return random.nextInt(1000);
    }

    @GetMapping("/square/{number}")
    public int calculateSquare(@PathVariable int number) {
        return number * number;
    }
}

